<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@taglib  uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<metaname="viewport"content="width=device-width, initial-scale=1.0">
<title>Insert title here</title>
<link rel="stylesheet" type="text/css" href="/resource/css/bootstrap.min.css" />
<script type="text/javascript" src="/resource/js/jquery-3.2.1.js"></script>
<script type="text/javascript" src="/resource/js/bootstrap.min.js"></script>
<script src="https://cdn.bootcss.com/blueimp-md5/2.10.0/js/md5.js"></script>
<script type="text/javascript" src="/resource/js/jquery.validate.js"></script>
<link rel="canonical" href="https://v4.bootcss.com/docs/examples/floating-labels/">

    
	
	
</head>
<body>
	<div align="center">
		<form class="form-signin" action="regist" method="post" id="registForm">
       <div class="text-center mb-4">
    <img class="mb-4" src="/resource/img/5.jpg" alt="" width="108" height="72">
    <h1 class="h3 mb-3 font-weight-normal">商城欢迎您</h1>
  </div>

  <div class="form-label-group">
    <input type="text" id="inputEmail" class="form-control" name="username" placeholder="用户名"  required="" autofocus="">
    <label for="inputEmail">用户名</label>
  </div>

  <div class="form-label-group">
    <input type="password" id="inputPassword" class="form-control" name="password" placeholder="密码" required="">
    <label for="inputPassword">密码</label>
  </div>
   <div class="form-label-group">
    <input type="password" id="repassword" class="form-control" name="repassword" placeholder="密码" required="">
    <label for="repassword">重复密码</label>
  </div>

  <button class="btn btn-lg btn-primary btn-block" type="submit">注册</button>
  <p class="mt-5 mb-3 text-muted text-center">© 2017-2020</p>
</form>
	</div>
</body>
<script type="text/javascript">
	$("#registForm").validate({
		submitHandler:function(form){
			//alert("提交方法被拦截");
			form.submit();
		},
		rules:{
			username:{
				remote:"./checkExist",
				required:true,
				minlength:3
			},
			password:{
				minlength:5
			},
			repassword:{
				equalTo:"#inputPassword"
			}
			
		},
		messages:{
			username:{
				remote:"用户已存在",
				required:"用户名必须输入",
				minlength:"用户名至少3个字母以上",
			},
			password:{
				minlength:"密码太短了"
			},
			repassword:{
				equalTo:"两次输入的密码必须一致"
			}
		}
		
		 
	})
</script>
</html>